import streamlit as st
import streamlit_antd_components as sac
from metawriter.ui.config import show_config
from metawriter.ui.demo import show_demo
def main():
    st.set_page_config(
        layout="wide",
        page_title="MetaWriter",
        page_icon=":books:",
    )
    st.markdown(f'''
        <style>
        .stApp .main .block-container{{
            padding:30px 50px
        }}
        .stApp [data-testid='stSidebar']>div:nth-child(1)>div:nth-child(2){{
            padding-top:50px
        }}
        iframe{{
            display:block;
        }}
        .stRadio div[role='radiogroup']>label{{
            margin-right:5px
        }}
        </style>
        ''', unsafe_allow_html=True)

    with st.sidebar.container():
        st.subheader(f'novel writer')
        menu = sac.menu(items=[
            sac.MenuItem('overview'),
            sac.MenuItem('system', children=[
                sac.MenuItem('config')
            ]),
            sac.MenuItem('demo'),
        ],
            key='menu',
            open_all=True, indent=20,
            format_func='title',
        )
    with st.container():
        if menu == 'config':
            show_config()
        elif menu == 'demo':
            show_demo()
if __name__ == "__main__":
    main()